<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;
class GoodsCollection extends JsonResource
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return [
            'goods_id'=>'1112'.$this->id,
            'goods_name'=>$this->title,
            'goods_img'=>$this->cover??'',
            'goods_type'=>12,
            'store_id'=>$this->mch_id, //店铺唯一id
            'price'=>$this->sale_price,
            'sotre_name'=>$this->mch?$this->mch->title:$this->mch_id
        ];
    }
}
